home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’95 / NDA - Nerf Digital Assistant / Project Data < prev    next >
Text File  |  1995-06-24  |  2KB  |  62 lines

  1. // Copyright © 1994 Apple Computer, Inc. All rights reserved
  2.  
  3. constant kAppSymbol := '|ACME Serial:PIEDTS|;        // Asynchronous Connection Manager Example for Serial endpoints
  4. constant kAppName := "ACME Serial";
  5.  
  6. constant kMaxAppWidth := 240;        // original MP width
  7. constant kMaxAppHeight := 336;        // original MP height
  8.  
  9. constant kPort_A := 'Main;
  10. constant kPort_B := 'SerialIR;
  11.  
  12. constant kRetryMaxCount:= 0;            // max number of times MConnect will try again to establish a connection
  13.  
  14. constant kState_Disconnected := 0;    // ready-to-go (default state)
  15. constant kState_Listen := 1;                // preparation for (asynchronous) listen
  16. constant kState_Listening := 2;            // in-process of (asynchronous) listen
  17. constant kState_Connect := 3;            // preparation for (asynchronous) connect
  18. constant kState_Connecting := 4;        // in-process of (asynchronous) connect
  19. constant kState_Connected := 5;        // connected (requires disconnect)
  20. constant kState_Disconnecting := 6;    // in-process of (asynchronous) disconnect
  21.  
  22. constant kError_EndpointInUse := -666;
  23.  
  24. constant kMessage_EndpointInUse := "Another application seems to be using the communications port.";
  25. constant kMessage_Disconnected := "Ready to connect…";
  26. constant kMessage_Listening := "Waiting for connection...";
  27. constant kMessage_Connecting := "Connecting...";
  28. constant kMessage_Connected_A := "Connected to MAIN serial port, awaiting disconnect...";
  29. constant kMessage_Connected_B := "Connected to INFRA-RED serial port, awaiting disconnect...";
  30. constant kMessage_Disconnecting := "Disconnecting, please wait...";
  31. constant kMessage_Retry := "No response...  Will try again...";
  32. constant kMessage_BufferOverrun := "A parity or bit-frame error has occured, or the communication data buffer was overrun and has been reset.";
  33.  
  34. // the following constants (kDA_StatusFrame, kDA_ActionFunc, kDA_AddDeferredAction)
  35. // are used to implement "killable" deferred actions --> see MAddDeferredAction for more info
  36. //
  37. DefConst(    'kDA_StatusFrame,
  38.                 {    fRunIt:    true,
  39.                     fRanIt:    nil,
  40.                     RanIt:    func()
  41.                                 fRanIt,
  42.                     KillIt:    func()
  43.                                 begin
  44.                                     fRunIt := nil;
  45.                                     fRanIt;
  46.                                 end,
  47.                 } );
  48. DefConst(    'kDA_ActionFunc,
  49.                 func(fn, args, status)
  50.                 begin
  51.                     status.fRanIt := true;
  52.                     if status.fRunIt then
  53.                         Apply(fn, args);
  54.                 end );
  55. DefConst(    'kDA_AddDeferredAction,
  56.                 func(fn, args)
  57.                 begin
  58.                     local status := {_proto: kDA_StatusFrame};
  59.                     AddDeferredAction(kDA_ActionFunc, [fn, args, status]);
  60.                     status;
  61.                 end );
  62.